# coding=utf-8
from urllib import request, parse
from http.cookiejar import CookieJar

cookier = CookieJar()
handler = request.HTTPCookieProcessor(cookier)

opener = request.build_opener(handler)

headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
}

data = {
    "email": "970138074@qq.com",
    "password": "pythonspider"
}

login_url = 'http://www.renren.com/PLogin.do'

req = request.Request(login_url, data=parse.urlencode(data).encode('utf-8'), headers=headers)
urlopen = request.urlopen(req)
print(urlopen.read().decode('utf-8'))
